#pragma once
#include <string>

#include <gl/glew.h>
#define NO_SDL_GLEXT //we want to use glew for extensions, not sdl.
#include <SDL.h>
#include "SDL_opengl.h"

#include <freeimage.h>


#include "Shader.h"

class Image
{
private:
	GLuint tex;
	GLuint fbo;
	GLuint depthBuffer; //depth buffer, only needed for depth test.
	int width;
	int height;
protected:
	void load(std::string path);
	void initFBO();
public:
	Image();
	Image(int width, int height); //doesn't contain any image data. Sets up an FBO for render to texture
	Image(std::string);
	~Image(void);

	int getHeight();
	int getWidth();

	void bind();
	GLuint getTextureID();
	void enable(); //direct all rendering to fbo
	void disable(); //stop directing of rendering to fbo

	void draw(int x, int y);
	void draw(int x, int y, float angle);
	void draw(int x, int y, int width, int height);
	void draw(int x, int y, int width, int height, float angle);
	void draw(int x, int y, int width, int height, float shiftX, float shiftY, float angle); //for shifting the texture

	void draw(int x, int y, Shader* s);
};
